package com.thoughtworks.preuniversityprogram.biblioteca;

/**
 * Created by padmavb on 6/10/14.
 */
public class Book {

    private String title;
    private String authorName;
    private int publishedYear;

    public  Book(String title,String authorName,int publishedYear){

        this.title=title;
        this.authorName=authorName;
        this.publishedYear=publishedYear;
    }
    public String getTitle(){
        return this.title;
    }

    public String getAuthorName(){
        return this.authorName;
    }
    public int getPublishedYear(){
        return this.publishedYear;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (publishedYear != book.publishedYear) return false;
        if (!authorName.equals(book.authorName)) return false;
        if (!title.equals(book.title)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = title.hashCode();
        result = 31 * result + authorName.hashCode();
        result = 31 * result + publishedYear;
        return result;
    }


}
